<?php
class DomArOneToManyRemove {
	
	/**
	 * @orm has many DomArOneToManyRemove inverse parent
	 * @orm listener beforeAdd beforeAdd
	 * @orm listener beforeRemove beforeRemove
	 */
	public $items;
	
	/**
	 * @orm has parent DomArOneToManyRemove inverse items
	 * @orm listener beforeSet beforeSet
	 */
	public $parent;
	
	/**
	 * @orm int(11)
	 */
	public $itemsCount = 0;
	
	/**
	 * @orm bool
	 */
	public $hasParent = false;
	
	public function beforeAdd() {
		$this->itemsCount++;
	}
	
	public function beforeRemove() {
		$this->itemsCount--;
	}
	
	public function beforeSet( $value ) {
		if( is_object($value) ) {
			$this->hasParent = true;
		} else {
			$this->hasParent = false;
		}
	}
}
?>